<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<div class="modal-dialog ms-modal-dialog" style="margin-top:50px;" >
  <div class="modal-content">
     
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
      <h4 class="modal-title">新增账户信息</h4>
    </div>
    
      <form class="form-horizontal ms-form form-personal-info" method="POST" id="form-account-create" action="${ctx.host}/accounts" data-validate="true">
        
        <!--<input type="hidden" name="_method" value="PATCH" />-->
        
         <div class="modal-body">
             
             <div class="form-group  ms-form-group">
	          <label class="control-label col-xs-3"><span class="text-red">*</span>邮箱：</label>
	          <div class="col-xs-8">
	            <input type="text" class="form-control" name="email" value="" placeholder="邮箱" data-validate="required|email" autocomplete="off" tabindex="1"/>
	          </div>
            </div>
            <div class="form-group  ms-form-group">
              <label class="control-label col-xs-3"><span class="text-red">*</span>登录账号：</label>
              <div class="col-xs-8">
                <input type="text" class="form-control" name="name" value="" placeholder="登录账号" data-validate="required" autocomplete="off" tabindex="3" readonly />
              </div>
            </div>
            <div class="form-group  ms-form-group">
	          <label class="control-label col-xs-3"><span class="text-red">*</span>密码：</label>
	          <div class="col-xs-8">
	            <input type="password" class="form-control" name="password" data-validate="required" value="" tabindex="2" placeholder="请输入密码" autocomplete="off" />
	          </div>
	        </div>
	        <div class="form-group  ms-form-group">
              <label class="control-label col-xs-3"><span class="text-red">*</span>姓名：</label>
              <div class="col-xs-8">
                <input type="text" class="form-control" name="username" value="" placeholder="用户名称" data-validate="required" autocomplete="off" tabindex="3" />
              </div>
            </div>
            <div class="form-group  ms-form-group">
	          <label class="control-label col-xs-3"><span class="text-red">*</span>帐号类型：</label>
	            <div class="col-xs-8 pull-left">
	              <select class="select2 form-control" name="authority" id="isAdmin"  data-validate="required"  tabindex="4">
	              	<c:forEach var="role" items="${secure.rolelist()}">
	                	<option value="${role.name}">${role.description}</option>
	                </c:forEach>
	              </select>
	             </div>
            </div>
        
        <div class="form-group  ms-form-group department">
	          <label class="control-label col-xs-3"><span class="text-red">*</span>所在部门：</label>
	            <div class="col-xs-8 pull-left">
	              <select class="select2 form-control" name="departmentId" data-validate="required" tabindex="5" >
	                <c:forEach items="${persist.departments()}" var="department">
	                  <option value="${department.id}">${department.name}</option>
	                </c:forEach>
	              </select>
	             </div>
            </div>
        
        </div>
      <div class="modal-footer ms-modal-footer">
        <button type="submit" class="btn btn-shadow-success btn-shadow umu-btn" >确定</button>
        <button type="button" class="btn btn-shadow-default btn-shadow umu-btn" data-dismiss="modal">取消</button>
      </div>

      </form>
    
  </div>
</div>
<script type="text/javascript">
var role =document.getElementById("isAdmin").value;
if(role == "ROLE_DEPARTMENT_USER") {
    $('.department').removeClass('hide')
} else {
    $('.department').addClass('hide')
}
</script>